package com.welike.shibo.eneity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.welike.shibo.enums.BaseStatusEnum;
import com.welike.shibo.enums.GenderEnum;
import lombok.Data;

import java.util.Date;

/**
 * Created by fangyu on 2019-08-20.
 */
@Data
@TableName(value = "user")
public class User {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    @JsonIgnore
    private Integer id;

    /**
     * 主账号
     */
    @TableField(value = "uid")
    private String uid;

    /**
     * 手机号
     */
    @TableField(value = "phone")
    private String phone;

    /**
     * 性别，1-男，2-女
     */
    @TableField(value = "gender")
    private Integer gender;

    /**
     * 昵称
     */
    @TableField(value = "nickname")
    private String nickname;

    /**
     * 密码
     */
    @TableField(value = "password")
    @JsonIgnore
    private String password;

    /**
     * 生日
     */
    @TableField(value = "birthday")
    private String birthday;

    /**
     * 地址
     */
    @TableField(value = "address")
    private String address;

    /**
     * 头像
     */
    @TableField(value = "avatar")
    private String avatar;

    /**
     * 个性签名
     */
    @TableField(value = "signature")
    private String signature;

    /**
     * 等级，1-普通，2-白银
     */
    @TableField(value = "level")
    private Integer level;

    /**
     * 状态
     */
    @TableField(value = "status")
    @JsonIgnore
    private Integer status;

    /**
     * 注册时间
     */
    @TableField(value = "reg_time")
    private Date regTime;

    /**
     * 设备id
     */
    @TableField(value = "device_id")
    private String deviceId;

    /**
     * 设备类型
     */
    @TableField(value = "device_type")
    private String deviceType;

    public static final String COL_ID = "id";

    public static final String COL_UID = "uid";

    public static final String COL_PHONE = "phone";

    public static final String COL_GENDER = "gender";

    public static final String COL_NICKNAME = "nickname";

    public static final String COL_PASSWORD = "password";

    public static final String COL_BIRTHDAY = "birthday";

    public static final String COL_ADDRESS = "address";

    public static final String COL_AVATAR = "avatar";

    public static final String COL_SIGNATURE = "signature";

    public static final String COL_LEVEL = "level";

    public static final String COL_STATUS = "status";

    public static final String COL_REG_TIME = "reg_time";

    public static final String COL_DEVICE_ID = "device_id";

    public static final String COL_DEVICE_TYPE = "device_type";

    public User(){
    }

    public User(String uid, String phone, String password, Integer level, Date regTime) {
        this.uid = uid;
        this.phone = phone;
        this.gender = GenderEnum.MALE.getCode();
        this.nickname = "未设置";
        this.password = password;
        this.birthday = "-";
        this.address = "-";
        this.avatar = "201909011024.jpg";
        this.signature = "暂无个性签名";
//        this.level = LevelEnum.NORMAL.getCode();
        this.level = level;
        this.status = BaseStatusEnum.NORMAL.getCode();
        this.regTime = regTime;
    }
}